package com.spdb.spdbfl.restful.quotedprice;

import com.alibaba.fastjson.JSONObject;
import com.spdb.spdbfl.config.BaseConfig;
import com.spdb.spdbfl.utils.ConfigProperty;
import com.spdb.spdbfl.utils.HttpRequest;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

@Test
public class GetSofrInterestIT {

    public static final String getSofrInterestUrl = "/quotedprice/sofr/getSofrInterest";
    static String domainUrl = "";
    static String token = "";
    static String url = "";

    @Test(description = "获取token，拼接url", priority = 0)
    @BeforeClass
    public static void setUp() throws Exception {
        domainUrl = BaseConfig.domainUrl;
        url = domainUrl + getSofrInterestUrl;
        token = ConfigProperty.getProperty("liumToken");
    }


    @Test(description = "新增/更新租赁物汇总信息", priority = 0)
    public static void getSofrInterest() {
        String param = getSofrInterestParam();
        HttpRequest httpRequest = new HttpRequest();
        String result = httpRequest.httpPost(url, token, param);

        JSONObject jsonResult = JSONObject.parseObject(result);
    }

    private static String getSofrInterestParam() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("delayPaymentDays", "");
        jsonObject.put("interestCalculateMode", "SIMPLE");
        jsonObject.put("interestPeriodBeginDate", "");
        jsonObject.put("interestPeriodEndDate", "");
        jsonObject.put("lastRecentDays", "");
        jsonObject.put("lockInterestRateDays", "");
        jsonObject.put("lookBackDays", "");
        jsonObject.put("marginRate", "");
        jsonObject.put("principalAmount", "");
        jsonObject.put("sofrInterestMode", "PLAIN");

        return jsonObject.toJSONString();
    }
}
